import pyttsx3
engine = pyttsx3.init()

# 获取所有可用的语音
voices = engine.getProperty('voices')
for voice in voices:
    print(f"ID: {voice.id} | Name: {voice.name} | Lang: {voice.languages}")

# 尝试设置中文语音（如果你的系统上有）
for voice in voices:
    if 'zh' in voice.id or 'chinese' in voice.name.lower():
        engine.setProperty('voice', voice.id)
        break

engine.say("你好，世界")
engine.runAndWait()